package com.gs.api.projects.bzapplets.web;

import com.gs.api.projects.bzapplets.entity.BzBanner;
import com.gs.api.projects.bzapplets.service.BzBannerService;
import com.gs.api.core.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author guoyunfei on 2021/7/9 14:03
 * @className BzBannerDao
 * @description TODO
 * @Version 1.0
 */

@RestController
@RequestMapping("{appid}/banner")
@Api(tags = "首页banner")
public class BzBannerController {

    @Autowired
    private BzBannerService bzBannerService;

    @ApiOperation(value = "首页banner图片", notes="首页banner图片")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "appid", value = "小程序appid", required = true, dataType = "String"),
    })
    @GetMapping("/bannerList")
    public Result bannerList(@PathVariable String appid){
        BzBanner banner = new BzBanner();
        banner.setEnable(1);
        banner.setAppid(appid);
        List<BzBanner> bzBanners = bzBannerService.bannerList(banner);
        return Result.success(bzBanners);
    }

}
